/*******************************************************************************
 * Copyright 2009 Dop Sun
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/
/**
 * Place holder for copyright, needs to be replaced before release.
 */
package com.softao.ming.gde.internal.core.ant;

import org.eclipse.pde.internal.build.ant.AntScript;
import org.eclipse.pde.internal.build.ant.ITask;

/**
 * 
 */
@SuppressWarnings("restriction")
public class GwtCompileTask implements ITask {
	private String mOutputLocation;
	private String mEntryPointClass;
	private String classpathId;

	/**
	 * 
	 */
	public GwtCompileTask() {
	}
	
	@Override
	public void print(AntScript script) {
		script.printTab();
		script.printTab();
		script.print("<java");
		script.printAttribute("classname", "com.google.gwt.dev.GWTCompiler", true);
		script.printAttribute("fork", "true", true);
		script.println(">");
		
		script.printTabs();
		script.print("<arg");
		script.printAttribute("value", "-out", true);
		script.println("/>");
		script.printTabs();
		script.print("<arg");
		script.printAttribute("value", mOutputLocation, true);
		script.println("/>");
		script.printTabs();
		script.print("<arg");
		script.printAttribute("value", "%*", true);
		script.println("/>");
		
		script.printTabs();
		script.print("<jvmarg");
		script.printAttribute("value", "-Xmx512M", true);
		script.println("/>");
		
		script.printTabs();
		script.print("<arg");
		script.printAttribute("value", mEntryPointClass, true);
		script.println("/>");
		
		script.printTabs();
		script.print("<classpath");
		script.printAttribute("refid", classpathId, true);
		script.println("/>");
		
		script.println("</java>");
	}

	/**
	 * @param outputLocation the outputLocation to set
	 */
	public void setOutputLocation(String outputLocation) {
		mOutputLocation = outputLocation;
	}

	/**
	 * @return the outputLocation
	 */
	public String getOutputLocation() {
		return mOutputLocation;
	}

	/**
	 * @param entryPointClass the entryPointClass to set
	 */
	public void setEntryPointClass(String entryPointClass) {
		mEntryPointClass = entryPointClass;
	}

	/**
	 * @return the entryPointClass
	 */
	public String getEntryPointClass() {
		return mEntryPointClass;
	}

	/**
	 * @param classpathId the classpathId to set
	 */
	public void setClasspathId(String classpathId) {
		this.classpathId = classpathId;
	}

	/**
	 * @return the classpathId
	 */
	public String getClasspathId() {
		return classpathId;
	}
}
